/**
 * Created by Apple on 2017/7/27.
 */
alert("11111111111111")
window.onload = function () {
class Tzs {
    constructor() {
        this.oDiv = document.querySelector("#div1");
        this.oLeft = 0;
        this.oTop = 0;
        this.init()
    }

    init() {
        const _this = this;
        this.oDiv.onmousedown = function (ev) {
            _this.tzDown(ev)
        }
    }

    tzDown() {
        var ev = ev || event;
        this.oLeft = ev.clientX - this.oDiv.offsetLeft;
        this.oTop = ev.clientY - this.oDiv.offsetTop;
        const _this = this;
        document.onmousemove = function (ev) {
            _this.tzMove(ev)
        }
        document.onmouseup = this.tzUp;

        return false
    }

    tzMove() {
        var ev = ev || event;
        this.oDiv.style.left = ev.clientX - this.oLeft + "px";
        this.oDiv.style.top = ev.clientY - this.oTop + "px"
    }

    tzUp() {
        document.onmouseup = null;
        document.onmousemove = null;
    }
}


    new Tzs();
}
